package framework.grid;

import java.util.ArrayList;

import framework.automaton.State;


/**
 * This interface outlines the methods that must be implemented by a Grid.
 * The Grid has references to multiple instances of type State.
 * 
 * @author Bill Ge, May Zhai, Alex Yoo
 *
 */
public interface Grid{
	
	/** 
	 * @param loc
	 * @return the given State found at a given Location in this Grid.
	 */
	public State get(Location loc);
	
	/**
	 * @param loc
	 * @return an ArrayList of the neighbors of a given location.
	 */
	public ArrayList<State> getNeighbors(Location loc);
	
	/**
	 * @return the number of columns within this Grid.
	 */
	public int getNumCols();
	
	/**
	 * @return the number of rows within this Grid.
	 */
	public int getNumRows();
	
	/**
	 * Checks if a given location is valid or not within this Grid.
	 * 
	 * @param loc
	 * @return true if the location is valid
	 */
	public boolean isValid(Location loc);

	
	/**
	 * Place the State at the given loc within this Grid.
	 * 
	 * @param loc
	 * @param obj
	 * @return true is object was successfully placed
	 */
	public boolean put(Location loc, State state);
	
	/**
	 * Factory method for creating a Grid, to be defined by the plugin author.
	 * @param rows
	 * @param cols
	 * @return a new Grid
	 */
	public Grid createNewGrid(int rows, int cols);
}
